﻿#region Usings

using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;

#endregion

namespace Rail.Net.Core.Model
{
    [Serializable]
    [DataContract]
    [KnownType(typeof(Distance))]
    [KnownType(typeof(PriceDistance))]
    [KnownType(typeof(PriceDomestic))]
    [KnownType(typeof(PriceSerial))]
    [KnownType(typeof(Relation))]
    [KnownType(typeof(RelationDescription))]
    [KnownType(typeof(RelationRu))]
    [KnownType(typeof(Station))]
    public class BaseIdentifiable : IEquatable<BaseIdentifiable>
    {
        //[Key]
        [DataMember]
        public long Id { get; set; }

        public bool Equals(BaseIdentifiable other)
        {
            if (Id != 0 && other.Id != 0)
                return Id == other.Id;
            return false;
        }
    }
}